package com.aaa.web.controller.statisticscontroller;

import com.aaa.web.service.istatisticsservice.IStatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

/**
 * @description: 数据统计
 * @author: lianghuige
 * @create: 2018-12-25 13:14
 **/
@Controller
@RequestMapping("/statistics")
public class StatisticsController {
    @Autowired
    private IStatisticsService statisticsService;

    /**
     * 跳转至统计界面
     * @return
     */
    @RequestMapping("/toStatistics")
    public String toStatistics() {
        return "views/webhtml/statistics/statistics";
    }
    /**
     * 获取电瓶车 销售信息
     * 电瓶车零件销售信息
     * 维修车辆信息
     * 电瓶更换信息
     * 传过来的日期如果是null 的，就给一个默认值是“ ”，sql语言即可判断
     * @return
     */
    @RequestMapping("/findBatterySalesInfo")
    @ResponseBody
    public Map findBatterySalesInfo(String year, String condition, @RequestParam(defaultValue="",required = false)String startTime,@RequestParam(defaultValue="",required = false)String endTime) {

        return statisticsService.findBatterySalesInfo(year,condition,startTime,endTime);
    }
}
